package bz.ziro.kanbe.controller.mng.log;

import java.util.List;
import java.util.logging.Logger;

import org.slim3.controller.Navigation;

import bz.ziro.kanbe.bean.Pager;
import bz.ziro.kanbe.controller.mng.PagerController;
import bz.ziro.kanbe.dao.LogDao;
import bz.ziro.kanbe.model.Log;

/**
 * ログリストを取得
 * @author Administrator
 */
public class ListController extends PagerController {

    @SuppressWarnings("unused")
    private static final Logger logger = Logger.getLogger(ListController.class.getName());

	@Override
	protected Integer getCount() {
        String siteKeyBuf = sessionScope("siteKey");
        Long siteLngKey = Long.valueOf(siteKeyBuf);
        return LogDao.count(siteLngKey);
	}

	@Override
	protected Integer getLimit() {
		return 5;
	}

	@Override
	protected Navigation runPager(Pager pager) {

        String siteKeyBuf = sessionScope("siteKey");
        Long siteLngKey = Long.valueOf(siteKeyBuf);
        //ページのデータを取得
        List<Log> logList = LogDao.findPageList(siteLngKey,pager);
        requestScope("logList",logList);

        return forward("list.jsp");
	}
}
